package com.zouxs.controller;

import com.zouxs.service.impl.UserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserController {
    private UserController() {
        System.out.println("我被执行了");
    }

    public static void main(String[] args) {
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("spring01.xml");
        UserController userController = (UserController) beanFactory.getBean("userController");
        userController.findAll();

    }

    public void findAll() {
        System.out.println("UserController findAll");
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("spring01.xml");

        UserService userService = (UserService) beanFactory.getBean("userService");
        userService.findAll();
    }

    public void getById() {
        System.out.println("UserController getById");
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("spring01.xml");

        UserService userService = (UserService) beanFactory.getBean("userService");
        //userService.getById();
    }
}
